home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / hdf / mac / h10srcst.hqx / Source / HyperHell Source / App NCSA TektoPICT / rghp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-29  |  2.0 KB  |  131 lines

  1. #ifndef lint
  2. static char *SCCSid = "%W%    (NCSA)    %G%";
  3. #endif
  4.  
  5. /*
  6.  
  7. rghp.c by Aaron Contorer for NCSA
  8. Copyright 1987, board of trustees, University of Illinois
  9.  
  10. Routines for HP-GL plotter output.  Only 1 window output at a time.
  11.  
  12. */
  13.  
  14. #define TRUE 1
  15. #define FALSE 0
  16.  
  17. static char *HPname = "Hewlett-Packard HP-GL plotter";
  18. static char busy; /* is device already in use */
  19. static int winbot,winleft,wintall,winwide;
  20.     /* position and size of window into virtual space */
  21. static int (*outfunc)();
  22.     /* the function to call with pointer to strings */
  23. static char HPtext[100];
  24.     /* the string containing the HP-GL output text */
  25. static int HPpenx,HPpeny;
  26. static int HPblank;
  27. static int HPcolor;
  28.  
  29. static signore(s)
  30. char *s;
  31. /* Ignore the string pointer passed here. */
  32. {}
  33.  
  34.  
  35. RGHPoutfunc(f)
  36. int (*f)();
  37. /*
  38.     Specify the function that is to be called with pointers to all
  39.     the HP-GL strings.
  40. */
  41. {
  42.     outfunc = f;
  43. }
  44.  
  45.  
  46. static HPbegin()
  47. /* set up environment for whole new printout */
  48. {
  49.     (*outfunc)("IN;SP1;SC-50,4370,-100,4120;PU0,0;");
  50.     HPpenx = HPpeny = 0;
  51. }
  52.  
  53. int RGHPnewwin()
  54. {
  55.     if (busy) return(-1);
  56.  
  57.     HPtext[0] = '\0';
  58.     HPpenx = HPpeny = 0;
  59.     HPblank = TRUE;
  60.     HPcolor = 100;
  61.     return(0);
  62. }
  63.  
  64. RGHPclrscr(w){
  65.     RGHPpagedone(w);
  66. }
  67.  
  68. RGHPclose(w) {
  69.     RGHPclrscr(w);
  70.     busy=FALSE;
  71. }
  72.  
  73. RGHPpoint(w,x,y) {
  74.     (*outfunc)("PD;PU;");
  75.  
  76. RGHPdrawline(w,x0,y0,x1,y1)
  77. int w,x0,y0,x1,y1;
  78. {
  79.     if (HPblank) {
  80.         HPbegin();
  81.         HPblank = FALSE;
  82.     }
  83.  
  84.     if (x0 != HPpenx || y0 != HPpeny) {
  85.         /* only move pen if not already there */
  86.         sprintf(HPtext,"PU%d,%d;",x0, y0);
  87.         (*outfunc)(HPtext);
  88.     }
  89.     sprintf(HPtext,"PD%d,%d;",x1, y1);
  90.     (*outfunc)(HPtext);
  91.     HPpenx=x1;
  92.     HPpeny=y1;
  93. }
  94.  
  95. RGHPpagedone(w) {
  96.     (*outfunc)("PG;");
  97.     HPblank = TRUE;
  98. }
  99.  
  100. RGHPdataline(w,data,count) {}
  101.  
  102. RGHPpencolor(w,color) {
  103.     color &= 7;
  104.     if (color) {
  105.         sprintf(HPtext,"SP%d;",color);
  106.         (*outfunc)(HPtext);
  107.     }
  108. }
  109.  
  110. RGHPcharmode(w,rotation,size) {}
  111. RGHPshowcur() {}
  112. RGHPlockcur() {}
  113. RGHPhidecur() {}
  114. RGHPbell(w) {}
  115. RGHPuncover(w) {}
  116.  
  117. char *RGHPdevname() {
  118.     return(HPname);
  119. }
  120.  
  121. RGHPinit() {
  122.     busy=FALSE;
  123.     outfunc=signore;
  124. }
  125.  
  126. RGHPinfo(w,a,b,c,d,v) {}
  127.  
  128. RGHPgmode() {}
  129. RGHPtmode() {}
  130.